home *** CD-ROM | disk | FTP | other *** search
- /*) Ban generator v1.0 for Grapevine 2.0
- \\\ Written by Josef Faulkner (panther@gate.net) IRC: Arexx
- ///
- \\\ Features:
- /// ~~~~~~~~~
- \\\ - Supports IP addresses as well as names
- /// - bans hostname by last two parts
- \\\ - Removes ~ and ^ characters from userid
- ///
- \\\ Format:
- /// ~~~~~~~
- \\\ This program converts as following:
- ///
- \\\ user@host.dom --> *!*user@*host.dom
- /// ^user@my.really.long.name.host.dom --> *!*user@*host.dom
- \\\ ~user@127.0.0.1 --> *!*user@127.0.0.*
- ///
- \\\ Installation:
- /// ~~~~~~~~~~~~~
- \\\ ASSIGN GV: to wherever you store your arexx programs!
- ///
- \\\ /alias xban rx xban.gv
- ///
- \\\ or add to your startup.gv:
- /// alias xban 'rx xban.gv'
- \\\
- /// Usage:
- \\\ ~~~~~~
- /// /xban <nick> - Bans <nick>
- \\\ /xban -<nick> - Unbans <nick>
- ///
- \\\ Special Notes:
- /// ~~~~~~~~~~~~~~
- \\\ HACK ALERT - Be Careful!
- ///
- \\\ This is the first program I am distributing that uses the "scan log"
- /// feature to get results back from grapevine. Some precautions must be
- \\\ taken for this to work, or to prevent from banning the wrong person:
- ///
- \\\ 1. DO NOT use the /who command between the time you issue the /xban command
- /// and the ban is actually put into place. This could result in the person you
- \\\ do a /who on, getting banned instead.
- ///
- \\\ 2. You cannot use logs, if you have a log running, it will be stopped when
- /// this program is executed
- \\\
- /// 3. You must have GV: assigned, if it isnt assigned I dont know what will
- \\\ happen :)
- ///
- \\\ Technical Notes:
- /// ~~~~~~~~~~~~~~~~
- \\\ This program calls itself again, because the logs cant be used on scripts
- /// directly called from GV. If you find your server is slow, increase the
- \\\ delay() value. If you find that the bans take too long, and the who
- /// info returns fairly quickly, decrease it.
- \\\
- (*/
-
- options results
- parse arg nick addr
- if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then do
- 'echo You need rexxsupport.library version 30 or greater in libs:'
- exit 10
- end
- nick=strip(nick)
- if left(nick,1)='-' then do
- nick=right(nick,length(nick)-1)
- unban=1
- end
- else unban=0
- addr=strip(addr)
- if addr='' then do
- parse source . . thisscript .
- thissscript=strip(thisscript)
- address command 'run rx 'thisscript' 'nick' 'address()
- end
- else do
- interpret 'address 'addr
- call delete('T:ban')
- 'closelog'
- 'log t:ban'
- 'who 'nick
- call delay(150)
- 'closelog'
- call open(1,'t:ban',r)
- done=0
- do until (eof(1))|(done)
- text=readln(1)
- if word(text,1)='«Who»' then do
- if upper(word(text,4))=upper(nick) then do
- banid=word(text,6)
- banid=strip(banid,'B','~')
- banid=strip(banid,'B','^')
- dots=0
- dotpos=1
- do until index(banid,'.',dotpos)=0
- dotpos=index(banid,'.',dotpos)+1
- dots=dots+1
- end
- host=left(reverse(banid),(index(reverse(banid),'@')-1))
- num=0
- if dots>1 then do
- if datatype(left(host,index(host,'.')),n)&(dots=3) then do
- bannum=reverse(right(host,length(host)-(index(host,'.'))))
- num=1
- end
- banhost=left(host,index(host,'.'))
- host=right(host,length(host)-length(banhost))
- banhost=banhost||left(host,index(host,'.')-1)
- banhost=reverse(banhost)
- if num then do
- banhost=bannum
- end
- end
- else banhost=reverse(host)
- if num then do
- banid='*!*'left(banid,index(banid,'@'))||banhost||'.*'
- end
- else do
- banid='*!*'left(banid,index(banid,'@'))||'*'||banhost
- end
- if unban then 'unban 'banid
- else 'ban 'banid
- done=1
- end
- end
- end
- call close(1)
- if done=0 then 'echo 'nick' not on IRC.'
- call delete('t:ban')
- end
- exit
-